<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>文件上传</title>
<!-- 公用JS引入开始 -->
<script type="text/javascript" src="${ctx }/js/jquery-2.2.3.min.js"></script>
</head>
<body>
	<form id="uploadForm" class="uploadForm" enctype="multipart/form-data">
		<input type="hidden" name="groupId" value="05b73c40e61811e79c540800272d89a2">
		<input type="hidden" name="hotelId" value="05b73f46e61811e79c540800272d89a2">
		<input type="hidden" name="hotelCode" value="001">
		<input type="hidden" name="empId" value="05b740b1e61811e79c540800272d89a2">
		<input type="hidden" name="empCode" value="1">
		<input type="hidden" name="empName" value="admin123">
		<input type="hidden" name="resourceType" value="1">
		<input type="hidden" name="typeId" value="dfds99dsf8ds8fd8sf8ds8fds8f8ds8f">
		<input type="hidden" name="typeName" value="主卧">
		<input class="chooseLocalImg" type="file" name="documentFile" id="documentFile1" value="" accept="image/gif, image/jpeg, image/png" />
		<input type="button" value="上传" onclick="upload()">
	</form>
</body>
<script type="text/javascript">
function upload() {
	$.ajax({
	    url:  'upload/file',
	    type: 'post',
	    cache: false,
	    data: new FormData($('#uploadForm')[0]),
	    processData: false,
	    contentType: false
	}).done(function(r) {
		console.info(r);
		//上传成功把文件传到后台服务器
		/* var arr = JSON.parse(r).data[0].filepath.split("/");
		var jsondata = {rows:[{
			resourcedesc : JSON.parse(r).data[0].oldfilename,
			resourceurl : JSON.parse(r).data[0].filepath,
			filename : arr[arr.length-1],
			filesize : JSON.parse(r).data[0].filesize,
			resourcetype : '2',
			groupid : $(".current").attr('data-groupid'),
			duration : duration
		}]}; */
	}).fail(function(r) {
		console.info(r);
	});
}
</script>
</html>